﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<cludg.Web.ViewModels.StoryAddModel>" %>

<asp:Content ID="Content0" ContentPlaceHolderID="HeadContent" runat="server">
	<link rel="stylesheet" href="../../Content/redactor/css/redactor.css" type="text/css" media="all"/>
	<script type="text/javascript" src="../../Scripts/redactor.js"></script>	

	<script type="text/javascript">
		$(document).ready(
			function () {
				new Redactor('Body', { focus: true });
			}
		);
	</script>

</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Написать историю
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
	<h2>Новая история</h2>
	<% Html.EnableClientValidation(); %>
	<% using (Html.BeginForm("Add", "Story", FormMethod.Post , new Dictionary<string, object> { { "enctype", "multipart/form-data" } }))
	{%>
	<%: Html.ValidationSummary(true) %>
	<fieldset>
		<div class="editor-label">
			<%: Html.LabelFor(model => model.ImageUrl) %>
		</div>
		<div class="editor-field">
			<%: Html.TextBoxFor(model => model.ImageUrl) %>
			<%: Html.ValidationMessageFor(model => model.ImageUrl) %>
		</div>
		<div class="editor-label">
			<label>...или загрузить</label>
		</div>
		<div>
			<input type="file" id="fileUpload" name="<%: Model.ImageUploadFileName %>"/>
		</div>

		<div class="editor-label">
			<%: Html.LabelFor(model => model.Title) %>
		</div>
		<div class="editor-field">
			<%: Html.TextBoxFor(model => model.Title, new { style = "width: 100%; " })%>
			<%: Html.ValidationMessageFor(model => model.Title) %>
		</div>

		<% if (Model.SecurityInfo.IsAnonymouse)
		{%>
		<div class="editor-label">
			<%: Html.LabelFor(model => model.AnonymouseAuthorName) %>
		</div>
		<div class="editor-field">
			<%: Html.TextBoxFor(model => model.AnonymouseAuthorName) %>
			<%: Html.ValidationMessageFor(model => model.AnonymouseAuthorName) %>
		</div>

		<%} %>
		<div class="editor-label">
			<%: Html.LabelFor(model => model.Body) %>
		</div>
		<div class="editor-field">
			<%: Html.TextAreaFor(model => model.Body, new { style = "width: 100%; height: 320px;" })%>
			<%: Html.ValidationMessageFor(model => model.Body) %>
		</div>
		<div class="editor-label">
			<%: Html.LabelFor(model => model.Tags) %>
		</div>
		<div class="editor-field">
			<%: Html.TextBoxFor(model => model.Tags, new { style = "width: 100%; " })%>
			<%: Html.ValidationMessageFor(model => model.Tags)%>
		</div>
		<div style = "text-align: right; ">
			<input type="submit" value="добавить"/>
		</div>
	</fieldset>
	<% } %>
</asp:Content>
